package com.dlc.shop.user.platform.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dlc.shop.common.response.ServerResponseEntity;
import com.dlc.shop.common.util.PageParam;
import com.dlc.shop.user.common.model.UserScoreLog;
import com.dlc.shop.user.common.service.UserScoreLogService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 用户积分记录
 *
 * @author LGH
 * @date 2020-02-26 16:03:14
 */
@Tag(name = "用户积分记录")
@RestController
@AllArgsConstructor
@RequestMapping("/user/userScoreLog" )
public class UserScoreLogController {

    private final UserScoreLogService userScoreLogService;

    @GetMapping("/pageByUserId" )
    @Operation(summary = "获取指定用户的积分明细" , description = "获取指定用户的积分明细")
    @PreAuthorize("@pms.hasPermission('user:scoreLog:page')")
    public ServerResponseEntity<IPage<UserScoreLog>> getPageByUserId(PageParam<UserScoreLog> page, String userId) {
        IPage<UserScoreLog> resPage = userScoreLogService.getPageByUserId(page,userId);
        return ServerResponseEntity.success(resPage);
    }

}
